﻿using System;
using System.Web.UI.WebControls;
using System.Data;
using SQLHelper;

public partial class admin_User_Ban : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Master.OnlyAdmin();
        bind();
    }

    protected void Search(object sender, EventArgs e)
    {
        string search = TextBox1.Text.ToString();
        if (search != null)
        {
            Response.Redirect("~/admin/User/Search.aspx?search=" + search + "");
        }
    }

    // 分页
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        this.GridView1.PageIndex = e.NewPageIndex;
        bind();
    }

    // 绑定数据
    void bind()
    {
        //string sqlStr = "select * from users";
        string sqlStr = "select * from blacklist b left join users u on b.user_id = u.id";
        DataSet res = DB.GetDataWithQuerySecond(sqlStr, "users");
        GridView1.DataSource = res;
        GridView1.DataKeyNames = new string[] { "id" };
        GridView1.DataBind();
        DB.ColseSqlCon();
    }
}